Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php: builder #286

Merged
merged 21 commits into from
Sep 13, 2022
Merged

php: builder #286

merged 21 commits into from
Sep 13, 2022

Conversation

tinybeachthor
Copy link
Contributor

@tinybeachthor tinybeachthor commented Sep 2, 2022

Towards #240

  • Add a builder
  • Add php example
  • dev shell
  • Update php docs
  • more robust semver implementation
  • discoverer

Disable packagist.org repo for composer, use artifact or path repositories.

@tinybeachthor
Copy link
Contributor Author

Tested on https://github.com/composer/composer, build and devShell both work as expected.

@tinybeachthor tinybeachthor marked this pull request as ready for review September 9, 2022 20:54
@DavHau
Copy link
Member

DavHau commented Sep 12, 2022

  • Add php examples (need the builder merged first)

That should not be necessary. You can add the example flake under /examples/php/flake.nix, and then execute from the repo root: nix run .#tests-examples php

Alternatively navigate to /examples/php, then run:
nix flake lock --override-input dream2nix ../../
and
nix run .#resolveImpre / nix build ..etc.

Copy link
Member

@DavHau DavHau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all that valuable work. Just a few suggestions here.

@DavHau
Copy link
Member

DavHau commented Sep 12, 2022

I just added an example via e77c129. Working fine.

@DavHau
Copy link
Member

DavHau commented Sep 12, 2022

It seems like the composer example adds significant overhead to the test execution.
https://github.com/nix-community/dream2nix/runs/8303370789?check_suite_focus=true#step:5:3143
That is probably because of the slow nix git fetching. Maybe we can replace the example with a project, that doesn't have many dependencies.

@tinybeachthor
Copy link
Contributor Author

tinybeachthor commented Sep 13, 2022

@DavHau
I've disabled checks on the composer example, which speeds it up a little.
Running the tests locally I get:

Execution times:
1 sec: _d2n-indexer
37 sec: php_composer        <<--
44 sec: nodejs_workspace
52 sec: _d2n-extended-new-subsystem
56 sec: _d2n-init-pkgs
56 sec: rust_ripgrep
83 sec: nodejs_prettier
85 sec: _d2n-extended
131 sec: nodejs_eslint
143 sec: debian-binary
144 sec: rust_set-rust-toolchain
155 sec: rust_no-cargo-lock
163 sec: nodejs_mattermost-webapp
175 sec: python_aiohttp
209 sec: haskell_stack-lock
210 sec: nodejs_eslint-aggreagted
281 sec: haskell_cabal-plan

But does not seem to have any effect on the CI time.

@DavHau DavHau merged commit c2ebb96 into nix-community:main Sep 13, 2022
@aszenz
Copy link
Contributor

aszenz commented Sep 13, 2022

Thanks for this, I recently tried this builder on one of the projects but got this error:

error: Constraint "as" could not be parsed

The project composer.json uses aliases as described here:
https://getcomposer.org/doc/articles/aliases.md#aliases

@tinybeachthor
Copy link
Contributor Author

tinybeachthor commented Sep 13, 2022

@aszenz
Thank you for noticing and reporting this.
The builder does not handle some less-common composer features at the moment (like composer plugins, php version constraints, composer api, aliases, update/install script hooks, ...).
Could you link to the project or if it's a private, make a small example of the composer.json that produces this error?

@aszenz
Copy link
Contributor

aszenz commented Sep 14, 2022

@aszenz Thank you for noticing and reporting this. The builder does not handle some less-common composer features at the moment (like composer plugins, php version constraints, composer api, aliases, update/install script hooks, ...). Could you link to the project or if it's a private, make a small example of the composer.json that produces this error?

Sure here's a sample project on which running nix build .#packages.x86_64-linux.app/php fails with:
error: Constraint "as" could not be parsed

https://github.com/aszenz/php-app-nix

If i remove the as then i get an error about missing extensions, seems like the php extensions mentioned in composer.json are not available when the build runs

@tinybeachthor
Copy link
Contributor Author

@aszenz
#296 fixes both issues (inline version alias, extra php extenstions)

@DavHau DavHau added the summer-of-nix Issues/PRs opened by SoN participants label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
summer-of-nix Issues/PRs opened by SoN participants
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants